#!/bin/sh

echo "SLPDereg"
rm -f SLPDereg.actual.output
scriptdir=${srcdir}/SLPDereg

test -f ${srcdir}/slpd.pid && kill `cat ${srcdir}/slpd.pid` && rm ${srcdir}/slpd.pid
../slpd/slpd -r ${scriptdir}/slp.test.reg -p ${srcdir}/slpd.pid
RESULT=$?
if test $RESULT != 0; then
    echo "Unable to start slpd (error = $RESULT), test failed."
    exit $RESULT
fi

./testslpdereg service:registered 10.0.0.1 service:registered 10.0.0.1 >>  SLPDereg.actual.output
echo >> SLPDereg.actual.output
./testslpdereg service:registered 10.0.0.1 service:unregistered 10.0.0.1 >> SLPDereg.actual.output
echo >> SLPDereg.actual.output
./testslpdereg service:test 10.0.0.1 >> SLPDereg.actual.output
test -f ${srcdir}/slpd.pid && kill `cat ${srcdir}/slpd.pid` && rm ${srcdir}/slpd.pid
diff -c ${scriptdir}/SLPDereg.expected.output SLPDereg.actual.output
